package com.fs.utils;


import com.alibaba.fastjson.JSON;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class ResponseJSONUtil {
    public static void responseJSON(JsonData jsonData, HttpServletResponse response) throws IOException {
        if(jsonData == null){
            return;
        }
        String str = JSON.toJSONString(jsonData);
        PrintWriter out = response.getWriter();
        out.println(str);
        out.flush();
        out.close();
    }

}
